/*
 * @Description:
 * @Author: Junhuang
 * @Date: 2022-06-30 09:22:27
 * @LastEditTime: 2022-06-30 09:26:49
 * @LastEditors: Junhuang
 * @Reference:
 */
'use strict';

const Controller = require('egg').Controller;

class Live_danmuController extends Controller {
  async index() {
    const { ctx, app } = this;
    const res = await app.model.LiveDanmu.findAll({
      include: [
        {
          model: app.model.User,
          attributes: [[ 'id', 'user_id' ], 'username', 'nickname', 'avatar' ],
        },
        {
          model: app.model.Live,
          attributes: [[ 'id', 'live_id' ], 'title', 'cover', 'look_count', 'danmu_count', 'coin', 'key', 'status' ],
        },
      ],
    });
    return ctx.apiSuccesss(res);
  }
}

module.exports = Live_danmuController;
